<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath();
%>
<%@taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
<html>
<head>
<meta charset="UTF-8">
<meta name="copyright" content="Tencent" />
<meta name="keywords" content="" />
<meta name="description" content="" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="format-detection" content="telephone=no">
<meta name="viewport"
	content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0,user-scalable=no">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">

<title>活动</title>
<link href="<%=path%>/favicon.ico" rel="shortcut icon">
<%--<link rel="stylesheet" type="text/css"
	href="<%=path%>/css/marketing/public.css" />--%>
<link rel="stylesheet" type="text/css"
	href="<%=path%>/css/marketing/marketing.css" />
<link rel="stylesheet" type="text/css"
	href="<%=path%>/css/marketing/activity.css" />
<%--<link rel="stylesheet" href="<%=path%>/css/marketing/index.css"/>--%>

<link rel="stylesheet" type="text/css" href="<%=path%>/hplus/js/plugins/sweetalert/sweetalert2.min.css">
<link href="<%=path%>/hplus/css/bootstrap.min14ed.css?v=3.3.6" rel="stylesheet">
<link href="<%=path%>/hplus/css/font-awesome.min93e3.css?v=4.4.0" rel="stylesheet">
<link href="<%=path%>/hplus/css/plugins/iCheck/custom.css" rel="stylesheet">
<link href="<%=path%>/hplus/css/animate.min.css" rel="stylesheet">
<link href="<%=path%>/hplus/css/style.min862f.css?v=4.1.0" rel="stylesheet">	


<style>
	.sjmp{
        position: fixed;
        right: 0;
        top: 80px;
        padding: 10px;
        width: 40px;
        background: #fff;
        z-index: 22;
        color: #ffc105;
        border: 1px solid #eee;
        border-right: none;
    }
    .sjmp img{
        margin-left: -5px;
        margin-bottom: 5px;
    }
    .s_hdjs li a{
        float: right;
        color: #ffc105;
        text-decoration: underline;
    }
    .k_activity .s_hdjs ol {
	    padding: 20px 3% 30px;
	}
	
	.s_name_input input{
		padding:6px 0 6px 3%;		
	}
	
	.k_activity .s_name_input{
		margin: 0 5% 12px;
	}
	
	.k_activity .s_name_input i{
		display: block;
	    text-align: left;
	    font-weight:bold;
	    font-size:16px;
	    margin-bottom:6px;
	}
	
	.k_activity .s_name_input input{
		width:100%;
	}

</style>

</head>
<body class="s_activity_body" style="background:#fff">
    <div hidden="" style='margin:0 auto;width:0px;height:0px;overflow:hidden;'>
       <img id="sharePic" src="" width='700'>
    </div>
    <div hidden="" id="shareContent"></div>
    <div id="editor"></div>
	<div class="k_title1"></div>
	<p hidden="" class="sjmp" id="shardCardIntent"><img src="<%=path%>/images/marketing/sjmp.png" /><i id="sjmp">商家名片</i></p>
	<div class="s_detailed fix">
		<a id="branch_store" href="javascript:IntentBranch();"></a>
	    <hr />
	</div>

	<div class="k_activity">
        <div id="button_info" >

        </div>
	</div>
	<ul class="s_footer">
	</ul>
	<div class="s_popups">
		<div class="s_detailed_rule">
			<p>活动细则</p>
			<em><img src="<%=path%>/images/marketing/k_close.png" /></em>
			<ul id="activity_detail_rule">
			</ul>
		</div>
	</div>
	

	<script src="http://pv.sohu.com/cityjson?ie=utf-8"></script>
	
	<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script>
	<script src="<%=path%>/js/marketing/swiper-3.2.7.min.js"></script>
	<script src="<%=path%>/js/marketing/jquery.iosslider.js"></script>
	<script src="<%=path%>/js/marketing/jquery.lt_slide.js"></script>
	<script src="<%=path%>/js/marketing/validation.js"></script>
	<script src="http://res.wx.qq.com/open/js/jweixin-1.2.0.js"></script>
	<script type="text/javascript" src="<%=path%>/js/marketing/lengthlimit.js"></script>
	
	<script src="<%=path%>/hplus/js/bootstrap.min.js?v=3.3.6"></script>
	<script src="<%=path%>/hplus/js/plugins/sweetalert/sweetalert2.min.js"></script>
	<script type="text/javascript" src="<%=path%>/js/marketing/dialog.js"></script>
	 <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-cookie/1.4.1/jquery.cookie.min.js"></script>
	<script src="<%=path%>/js/marketing/public.js"></script>
	<script src="<%=path%>/js/system/province-city-area-data.js"></script>
	<script>
	
	
	function keyPress() {    
	     var keyCode = event.keyCode;    
	     if ((keyCode >= 48 && keyCode <= 57))    
	    {    
	         event.returnValue = true;    
	     } else {    
	           event.returnValue = false;    
	    }    
	 } 
	    
		var activity_id;
		var activity_type;
		var name;
		var mobile;
		var email;
		var weibo;
		var weixin;
		var job;
		var company;
		var access_token;
		var cid;
		var activity_pics;
		var customer_id;
		var transmit_num;
        var ip;
        
        var email_flag=false;
        var weixin_flag=false;
        var weibo_flag=false;
        var job_flag=false;
        var company_flag=false;
        var name_flag=false;
        var mobile_flag=false;
        var tag;
        var type;
        var open_way;
        
        var web_url;
        
        var share_title;
        var share_content;
        var share_pic;
        //判断当前页面是否转发而来
        var transmitTag=0;
        
        var extendField="";
    	var show_card=0;//是否显示商家名
    	var show_equipment=0;//是否显示环境设施
    	var show_activity_way=0;//是否显示活动方式
    	var show_collect=0;//是否显示收集信息
    	var show_sendType=0;//是否显示通知客户方式
    	var show_foot_info=0;//是否显示页脚信息
    	var card_text;//商家名片按钮文字
    	var activity_content_text;//活动介绍自定义文字
    	var activity_rule_text;//活动规则自定义文字
        var sms_batch;
    	
    	var submitFlag=true;
    	var cardId;
    	var openId;
    	var province="";
    	var city="";
    	var district="";
    	var couponBatch="";
    	var activityName="";
    	var taskId="";
    	var cityId="";//城市编码
    	var provinceId="";
    	
    	var channel_type;
       function IntentBranch(){
    	   window.location.href = "<%=path%>/view/ui/mobileStorePage?id="+activity_id+"&cid="+cid;
       }
		$(function() {
			web_url=window.location.href;
			type=getQueryString("type");
			sms_batch=getQueryString("batch");
			cardId=getQueryString("cardId");
			openId=$.cookie('weixinOpenId');
			channel_type=getQueryString("channel");
			taskId=getQueryString("taskId");
			couponBatch=getQueryString("couponBatch");;
			if(StringEmpty(getQueryString("isappinstalled"))||StringEmpty(getQueryString("appinstall"))){
				transmitTag=1;
			} else{
				transmitTag=0;
			}
			ip=returnCitySN["cip"];
			
			/* 
			province=remote_ip_info["province"];
			city=remote_ip_info["city"];
			district=remote_ip_info["district"]; 
			*/
			
			city = returnCitySN["cname"];
			cityId=getCityCodeByName(city);
			openWay();
			getDetail(); 
		});

		 $(document).on('click', '.s_rule', function() {
			 $('.s_popups').show();
				$('.s_detailed_rule').show();
		 });
		$('.s_detailed_rule em').click(function() {
			$('.s_popups').hide();
			$('.s_detailed_rule').hide();
		});
		//立即领取
		function ljlqAction() {
			 
			 if(name_flag){
				 name = document.getElementById("name_input").value;
				 if(!StringEmpty(name)){
					 errorDialog("请输入姓名");
						return ;
				 }
			 }
			 if(mobile_flag){
				 mobile = document.getElementById("mobile_input").value;
				 if(!StringEmpty(mobile)){
						errorDialog("请输入手机号码");
						return ;
				 }else if(!validatemobile(mobile)){
						errorDialog("您输入的手机号码不符合规范");
						return ;
				 }
			 }
			 if(email_flag){
				 email = document.getElementById("email_input").value; 
			 }
			 if(weibo_flag){
				 weibo = document.getElementById("weibo_input").value;
			 }
             if(weixin_flag){
           	     weixin = document.getElementById("weixin_input").value;
			 }
             if(job_flag){
           	    job = document.getElementById("job_input").value;
             }
            if(company_flag){
           	     company = document.getElementById("company_input").value;
            }
			if(submitFlag){
				 joinActivity(name,mobile);
		    }
		}
		
		
        //获取活动详情
		function getDetail() {
			activity_id = getQueryString("activity_id");
			customer_id= getQueryString("customerId");
			cid=getQueryString("cid");
			var url="<%=path%>/activity/ajaxActivityDetail";
			$.post(url, {
				"cid" : cid,
				"id" : activity_id,
			}, function(data) {
				if (data.status == 200) {
					setActivityHtml(data.data);
					activityStore();
					getWeinInfo();
				} else {

				}
			});

		}
        
        
		  //浏览
		function createBrowse() {
			var url="<%=path%>/activity/ajaxBrowseActivity";
			$.post(url, {
				"cid" : cid,
				"activityId" : activity_id,
				"customerId" : customer_id,
				"browseIp" : ip,
				"openWay" : open_way,
				"transmitTag":transmitTag,
				"smsBatch":sms_batch,
				"cardId":cardId,
				"openId":openId,
				"channelType":channel_type,
				"province":province,
				"city":city,
				"district":district,
				"couponBatch":couponBatch,
				"activityName":activityName,
				"taskId":taskId,
				"cityId":cityId,
				"provinceId":provinceId,
			}, function(data) {
				
			});

		}
        
        var customer_id;
        //参加活动
		function joinActivity(name,mobile) {
			var url="<%=path%>/activity/ajaxJoinActivity";
			submitFlag=false;
			var param={
					"cid" : cid,
					"activityId" : activity_id,
					"customerName" : name,
					"customerPhone":mobile,
					"weixin" : weixin,
					"weibo" : weibo,
					"job" : job,
					"company" : company,
					"email" : email,
					"openWay" : open_way,
					"transmitTag":transmitTag,
					"smsBatch":sms_batch,
					"cardId":cardId,
					"channelType":channel_type,
					"province":province,
					"city":city,
					"cityId":cityId,
					"district":district,
					"couponBatch":couponBatch,
					"taskId":taskId,
				};
			
			$.post(url, {
				"param":JSON.stringify(param)
				}, function(data) {
				submitFlag=true;
				if(data.status==200){
					var customerId=data.data;
					window.location.href = "<%=path%>/view/ui/mobileActivitySuccessPage?activityId="+activity_id+"&cid="+cid+"&customerId="+customerId+"&couponBatch="+couponBatch;
				}else if (data.status=="301"){ //参见过活动
                    var customerId=data.data;
                    window.location.href = "<%=path%>/view/ui/mobileActivitySuccessPage?activityId="+activity_id+"&cid="+cid+"&customerId="+customerId+"&couponBatch="+couponBatch+"&join=isJoin";
                }else{
                    errorDialog(data.message);

			}
            });
		}
		//设置活动信息
		function setActivityHtml(data) {
			console.log("--->"+data);
			share_pic=data.pic;
			share_title=data.title;
			share_content=data.content;
			
			$("#sharePic").attr("src",share_pic);
			$("shareContent").html(share_content);
			
			tag=data.activityType;
			var title='';
			var description='';
			var activity_detail_rule='';
			var activity_title='';
			if(tag=="defined_text"){
				$('.s_slide').hide();
				$('.s_rule').hide();
				$('#price').hide();
				$('.s_hdjs').hide();
				$('.k_title1').hide();
				$('.s_detailed fix').hide();
				$('#huanjing').hide();
				$('#h3-price').hide();
				$('.sjmp').hide();
				$('#editor').html(data.description);
				
				if(StringEmpty(data.remarks)){
					background_color=data.remarks;
					$(".s_activity_body").css("background-color",background_color);
					$(".k_activity").css("background-color",background_color);
					$(".s_detailed").css("background-color",background_color);
					$("#li_address").css("background-color",background_color);
				}
				$("#editor").find('img').css("max-width","100%");
                $("#editor").find('img').css("width","");
				$("#editor").find('img').css("height","");

			}
			/* $(document).attr("title",data.name);
			document.title=data.name; */
			
			activityName=data.name;
			var body = document.getElementsByTagName('body')[0];
			document.title = data.name;
			var iframe = document.createElement("iframe");
			iframe.style.display="none";
			iframe.setAttribute("src", "http://named.cn/page/take/img/icon_phone.png");
			var d = function() {
			    setTimeout(function() {
			        iframe.removeEventListener('load', d);
			        document.body.removeChild(iframe);
			    }, 0);

			};
			iframe.addEventListener('load', d);
			document.body.appendChild(iframe);
			
			
			//設置提交信息按钮框
			var commit_info=data.commitInfo.split(",");
			if(StringEmpty(commit_info)&&commit_info.length>0){
				var button_html='';
				for(var i=0;i<commit_info.length;i++){
					switch (commit_info[i]) {
					
					case "commit_name":
						name_flag=true;
						button_html+='<div class="s_name_input"><i>姓名</i><input id="name_input" type="text" maxlength="10" onblur="checkLength(this)"/></div>';
						break;
                    case "commit_mobile":
                    	mobile_flag=true;
                    	button_html+='<div class="s_name_input"><i>电话</i><input id="mobile_input" type="text" style="ime-mode:disabled;" onkeypress="keyPress()" maxlength="11"/></div>';
						break;
					case "commit_email":
						email_flag=true;
						button_html+='<div class="s_name_input"><i>邮箱</i><input id="email_input" type="email" maxlength="25" onblur="checkLength(this)"/></div>';
						break;
                    case "commit_weibo":
                    	weibo_flag=true;
                    	button_html+='<div class="s_name_input"><i>微博</i><input id="weibo_input" type="text" maxlength="20" onblur="checkLength(this)"/></div>';
						break;
                    case "commit_weixin":
                    	weixin_flag=true;
                    	button_html+='<div class="s_name_input"><i>微信</i><input id="weixin_input" type="text" maxlength="25" onblur="checkLength(this)"/></div>';
						break;
                    case "commit_job":
                    	job_flag=true;
                    	button_html+='<div class="s_name_input"><i>职位</i><input id="job_input" type="text" maxlength="15" onblur="checkLength(this)"/></div>';
						break;
                    case "commit_company":
                    	company_flag=true;
                    	button_html+='<div class="s_name_input"><i>公司</i><input id="company_input" type="text" maxlength="25" onblur="checkLength(this)"/></div>';
						break;
					default:
						break;
					}
				}
				button_html+='<div id="" onclick="javascript:ljlqAction();" class="s_get_btn"><a href="javascript:ljlqAction();">'+(data.buttonText!=""? data.buttonText:"立即领取")+' </a></div>';
				$('#button_info').html(button_html);
				
				if(StringEmpty(data.buttonCss)&&data.buttonCss!="#000000")
					$(".s_get_btn").css("background-color",data.buttonCss);
			}else{
				$(".k_activity").hide();
			}
				
			
		/* 		if(StringEmpty(data.weixin_qrcode)){
					console.log("weixin--->");
					var html_weixin='<li><img id="weixin_qrcode" src="'+data.weixin_qrcode+'" /><p>微信二维码</p></li>';
					$(".s_footer").append(html_weixin); 
				}
				
	            if(StringEmpty(data.weibo_qrcode)){
	            	console.log("weibo_qrcode");
	            	var html_weibo='<li><img id="weibo_qrcode" src="'+data.weibo_qrcode+'" /><p>微博二维码</p></li>';
					$(".s_footer").append(html_weibo); 
				} */
				if(StringEmpty(data.weixin_qrcode)||StringEmpty(data.weibo_qrcode))
					$(".s_footer").append('<li style="width:100%;margin-bottom:8px"><font color="black" size="3"> 扫一扫  请关注 </font></li>');
				
				if(StringEmpty(data.weixin_qrcode)&&!StringEmpty(data.weibo_qrcode)){
					console.log("weixin--->");
					var html_weixin='<li style="width:100%"><img id="weixin_qrcode" src="'+data.weixin_qrcode+'" /><p>微信二维码</p></li>';
					$(".s_footer").append(html_weixin); 
				}else if(StringEmpty(data.weixin_qrcode)){
					var html_weixin='<li><img id="weixin_qrcode" src="'+data.weixin_qrcode+'" /><p>微信二维码</p></li>';
					$(".s_footer").append(html_weixin); 
				}
				
	            if(StringEmpty(data.weibo_qrcode)&&!StringEmpty(data.weixin_qrcode)){
	            	console.log("weibo_qrcode");
	            	var html_weibo='<li style="width:100%"><img id="weibo_qrcode" src="'+data.weibo_qrcode+'" /><p>微博二维码</p></li>';
					$(".s_footer").append(html_weibo); 
				}else if(StringEmpty(data.weibo_qrcode)){
					var html_weibo='<li><img id="weibo_qrcode" src="'+data.weibo_qrcode+'" /><p>微博二维码</p></li>';
					$(".s_footer").append(html_weibo); 
				}
	            if(!StringEmpty(data.weixin_qrcode)&&!StringEmpty(data.weibo_qrcode)){
	            	$('.s_footer').hide();
	            }
	           
	            createBrowse();
		}
		
		var shareCardId="";
		function getShardCardId(){
			var url="<%=path%>/businessCard/getsharecard";
			$.post(url, {
				"cid" : cid,
			}, function(data) {
				
				
				if (data.status == 200) {
					shareCardId=data.data;
				} else {

				}
			});
		}
		$('#shardCardIntent').click(function() {
			if(StringEmpty(shareCardId))
			window.location.href = "<%=path%>/view/ui/card?cid="+cid+"&card_id="+shareCardId;
		});
		
		
/* 		 //判断是否为手机号码
	    function telPhone(cphone){
	    	var reg =/^1(3|4|5|7|8)\d{9}$/;//正则表达式 
	    	var result = reg.test(cphone);	//匹配
	    	if(!result){
	    		return false;
	    	}else{
	    		return true;
	    	}
	    } */
		/* //校验手机号码
		function validatemobile(mobile) {
			var myreg = /^(((13[0-9]{1})|(15[0-9]{1})|(17[0-9]{1})|(18[0-9]{1}))+\d{8})$/;
			if (mobile.length == 0) {
				showDialog('请输入手机号码！');
				document.form1.mobile.focus();
				return false;
			} else if (mobile.length != 11) {
				showDialog('请输入有效的手机号码！');
				document.form1.mobile.focus();
				return false;
			} else if (!myreg.test(mobile)) {
				showDialog('请输入有效的手机号码！');
				document.form1.mobile.focus();
				return false;
			} else {
				return true;
			}
		} */

		//判断字符串是否为空
		function StringEmpty(content) {
			if (content == undefined || content == "" || content == null) {
				return false;
			} else {
				return true;
			}
		}
		   //获取url的参数
		function getQueryString(name) {
			var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
			var r = window.location.search.substr(1).match(reg);
			if (r != null)
				return unescape(r[2]);
			return null;
		}
		   
		   
		 //获取活动门店信息
	    function activityStore(){
	    	var url = "<%=path%>/activityStore/ajaxListRelationActivityStore";
	    	$.post(url,{
				"cid" : cid,
				"activityId" : activity_id,
	    	},function(data){
	    		if(data.status == "200"){
	    			var stores=data.data;
			    	$('#branch_store').html('<li id="store_num">全部'+stores.length+'家分店<span class="into"></span></li><hr style="height:1px; color:#000000;">');
	    		}else{
	    			$('#li_address').hide();
			    	$('#branch_store').hide();
	    		}
	    	});
	    }
	  
	    
	    
	    //判断打开途径
	    function openWay(){
	    	//微信微博
	        var browser = {
	            versions: function() {
	                var u = navigator.userAgent,
	                    app = navigator.appVersion;
	                return { //移动终端浏览器版本信息
	                    trident: u.indexOf('Trident') > -1, //IE内核
	                    presto: u.indexOf('Presto') > -1, //opera内核
	                    webKit: u.indexOf('AppleWebKit') > -1, //苹果、谷歌内核
	                    gecko: u.indexOf('Gecko') > -1 && u.indexOf('KHTML') == -1, //火狐内核
	                    mobile: !!u.match(/AppleWebKit.*Mobile.*/), //是否为移动终端
	                    ios: !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/), //ios终端
	                    android: u.indexOf('Android') > -1 || u.indexOf('Linux') > -1, //android终端或uc浏览器
	                    iPhone: u.indexOf('iPhone') > -1, //是否为iPhone或者QQHD浏览器
	                    iPad: u.indexOf('iPad') > -1, //是否iPad
	                    webApp: u.indexOf('Safari') == -1 //是否web应该程序，没有头部与底部
	                };
	            }(),
	            language: (navigator.browserLanguage || navigator.language).toLowerCase()
	        }


	        if (browser.versions.mobile) { //判断是否是移动设备打开。browser代码在下面
	            var ua = navigator.userAgent.toLowerCase(); //获取判断用的对象

	         
	            if (browser.versions.ios) {
	            	open_way="sms";
	            	console.log("ios");
	            	
	            }
	            if (browser.versions.android) {
	            	open_way="sms";
	            	console.log("android");
	            }
	            if (ua.match(/MicroMessenger/i) == "micromessenger") {
                    //微信打开
	            	open_way="weixin";
	            	console.log("weixin");
	            }
	            if (ua.match(/WeiBo/i) == "weibo") {
	                //微博打开
	            	open_way="weibo";
	            	console.log("weibo");
	            }
	            if(ua.match(/qq/i) =="qq" && ua.match(/MicroMessenger/i) !=
	        		"micromessenger") {
	        	     open_way="qq";
                     //qq打开
		        }else if(navigator.userAgent.indexOf("MQQBrowser")>-1&& ua.match(/MicroMessenger/i) !=
            		"micromessenger"){
		        	open_way="qq";
		        }
	        } else {
	        	open_way="pc";
	            //否则就是PC浏览器打开
	        	console.log("pc");
	        }

	    
	    }
	    
	    var timestamp;
	    var signature;
	    var nonceStr;
	    var link_url;
	    var appid;
	    function getWeinInfo(){
	    	 console.log("------sssss---->"+window.location.href);
	    	 web_url = window.location.href.split('#')[0];  
	    	/* web_url = web_url.replace(/\&/g, '%26');  */
	    	console.log("web_url------->"+web_url);
	    	/* web_url=encodeURIComponent(web_url); */
	    	/* web_url=web_url+"&transmit=1"; */
	    	var url="<%=path%>/api/auth/share";
			$.post(url, {
				"url" : web_url,
			}, function(data) {
				
				timestamp=data.timestamp;
				signature=data.signature;
				nonceStr=data.nonceStr;
				link_url=data.url;
				console.log("substr----->"+link_url);
				console.log("timestamp------->"+timestamp);
				console.log("signature------->"+signature);
				console.log("nonceStr------->"+nonceStr);
				var reg = new RegExp("%26","g");
				link_url=link_url.replace(reg,"&");
				console.log("link_url"+link_url);
				appid=data.appId;
				config();
			});
	    }
	    
	    function config(){
	    	wx.config({
		        debug: false,
		        appId: appid,
		        timestamp: timestamp,
		        nonceStr: nonceStr,
		        signature: signature,
		        jsApiList: [
		          'checkJsApi',
		          'onMenuShareTimeline',
		          'onMenuShareAppMessage',
		          'onMenuShareQQ',
		          'onMenuShareWeibo',
		          'hideMenuItems',
		          'showMenuItems'
		        ]
		    });
	    	 wx.ready(function () {
	 	    	console.log("ready----------->");
	 	    	  wx.checkJsApi({
	 	    	      jsApiList: [
	 	    	        'getNetworkType',
	 	    	        'previewImage'
	 	    	      ],
	 	    	      success: function (res) {
	 	    	        console.log(JSON.stringify(res));
	 	    	      }
	 	    	    });
	 	    	  
	 	    	  // 2. 分享接口
	 	    	  // 2.1 监听“分享给朋友”，按钮点击、自定义分享内容及分享结果接口
	 	    	
	 	    	   /*  document.querySelector('#onMenuShareAppMessage').onclick = function () { */
	 				    wx.onMenuShareAppMessage({
	 				      title: share_title,
	 				      desc: share_content,
	 				      link: link_url,
	 				      imgUrl: encodeURI(share_pic),
	 				      trigger: function (res) {
	 				     
	 				      },
	 				      success: function (res) {
	 				    	 transmit("weixin_friend");
	 				      },
	 				      cancel: function (res) {
	 				        
	 				      },
	 				      fail: function (res) {
	 				        /* alert(JSON.stringify(res)); */
	 				      }
	                 });
	 	    	
	 				   wx.onMenuShareTimeline({
	 					  title: share_title,
	 				      desc: share_content,
	 				      link: link_url,
	 				      imgUrl: encodeURI(share_pic),
	 	 	    	      trigger: function (res) {
	 	 	    	      },
	 	 	    	      success: function (res) {
	 	 	    	    	transmit("time_line");
	 	 	    	      
	 	 	    	      },
	 	 	    	      cancel: function (res) {
	 	 	    	      },
	 	 	    	      fail: function (res) {
	 	 	    	      }
	 	 	    	    });
	 				   wx.onMenuShareQQ({
	 					  title: share_title,
	 				      desc: share_content,
	 				      link: link_url,
	 				      imgUrl: share_pic,	 				      
	 				      trigger: function (res) {
	 				      },
	 				      complete: function (res) {
	 				        /* alert(JSON.stringify(res)); */
	 				      },
	 				      success: function (res) {
	 				    	 transmit("qq");
	 				      },
	 				      cancel: function (res) {
	 				      },
	 				      fail: function (res) {
	 				        /* alert(JSON.stringify(res)); */
	 				      }
	 				    });
	 	    	   
	 	    	  // 2.2 监听“分享到朋友圈”按钮点击、自定义分享内容及分享结果接口
	 	    	
	 	    	   /*  wx.onMenuShareTimeline({
	 	    	      title: '互联网之子',
	 	    	      link: 'http://movie.douban.com/subject/25785114/',
	 	    	      imgUrl: 'http://img3.douban.commovie_poster_cover/spst/public/p2166127561.jpg',
	 	    	      trigger: function (res) {
	 	    	        alert('用户点击分享到朋友圈');
	 	    	      },
	 	    	      success: function (res) {
	 	    	        alert('已分享');
	 	    	      },
	 	    	      cancel: function (res) {
	 	    	        alert('已取消');
	 	    	      },
	 	    	      fail: function (res) {
	 	    	        alert(JSON.stringify(res));
	 	    	      }
	 	    	    });
	 	    	 
	 	    	  // 2.3 监听“分享到QQ”按钮点击、自定义分享内容及分享结果接口
	 	    	
	 	    	    wx.onMenuShareQQ({
	 	    	      title: '互联网之子',
	 	    	      desc: '在长大的过程中，我才慢慢发现，我身边的所有事，别人跟我说的所有事，那些所谓本来如此，注定如此的事，它们其实没有非得如此，事情是可以改变的。更重要的是，有些事既然错了，那就该做出改变。',
	 	    	      link: 'http://movie.douban.com/subject/25785114/',
	 	    	      imgUrl: 'http://img3.douban.commovie_poster_cover/spst/public/p2166127561.jpg',
	 	    	      trigger: function (res) {
	 	    	        alert('用户点击分享到QQ');
	 	    	      },
	 	    	      complete: function (res) {
	 	    	        alert(JSON.stringify(res));
	 	    	      },
	 	    	      success: function (res) {
	 	    	        alert('已分享');
	 	    	      },
	 	    	      cancel: function (res) {
	 	    	        alert('已取消');
	 	    	      },
	 	    	      fail: function (res) {
	 	    	        alert(JSON.stringify(res));
	 	    	      }
	 	    	    }); */
	 	    	   
	 	    	  });
	    }
	    	 
	    	 
	    //转发
		function transmit(transmit_way) {
			var url="<%=path%>/activity/ajaxTransmitActivity";
			$.post(url, {
				"cid" : cid,
				"activityId" : activity_id,
				"transmitTag": transmitTag,
				"transmitWay": transmit_way,
				"customerId": customer_id,
				"userClientIp": ip,
				"cardId": cardId,
				"openId": openId,
				"province":province,
				"city":city,
				"district":district,
				"cityId":cityId,
			}, function(data) {
				
			});

		} 	
	    	
	</script>


</body>
</html>
